using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Printing;

namespace dender.dvdcover.core
{
    /// <summary>
    /// Defines a format of a cover, defining its dimensions and it cutting lines.
    /// A cover is created using a format.
    /// </summary>
    public class Format : CoverBase<Part>
    {
        private string mDescription;
        /// <summary>
        /// Gets or sets the description of the format
        /// </summary>
        public string Description
        {
            get { return mDescription; }
            set { mDescription = value; }
        }

        private PageOrientation mPageOrientation;
        /// <summary>
        /// Gets or sets the default orientation of the page when printing the cover
        /// </summary>
        public PageOrientation PageOrientation
        {
            get { return mPageOrientation; }
            set { mPageOrientation = value; }
        }


        private PaperKind mPaperKind;
        /// <summary>
        /// Gets or sets the paperkind of the format.
        /// </summary>
        public PaperKind PaperKind
        {
            get
            {
                return mPaperKind;
            }
            set
            {
                mPaperKind = value;
            }
        }
	

        /// <summary>
        /// Creates a format defining width and height
        /// </summary>
        /// <param name="width">Width of the cover format</param>
        /// <param name="height">Height of the cover format</param>
        public Format(float width, float height, string description, 
                        PageOrientation pageOrientation, PaperKind paperkind) : base(width,height)
        {
            this.PageOrientation = pageOrientation;
            this.PaperKind = paperkind;
            this.Description = description;
        }

        /// <summary>
        /// Add the default cutting lines to the format. The default lines are the
        /// lines on the edge of the cover
        /// </summary>
        public void AddDefaultCuttingLines()
        {
            //Left Line
            this.CuttingLines.Add(
                    new CuttingLine(
                            new PointF(0, 0),
                            new PointF(0, Height)
                                    )
                                );

            //Top Line
            this.CuttingLines.Add(
                    new CuttingLine(
                            new PointF(0, 0),
                            new PointF(Width, 0)
                                    )
                                );

            //bottom line
            this.CuttingLines.Add(
                    new CuttingLine(
                            new PointF(0, Height),
                            new PointF(Width, Height)
                                    )
                                );

            //right line
            this.CuttingLines.Add(
                    new CuttingLine(
                            new PointF(Width, 0),
                            new PointF(Width, Height)
                                    )
                                );
        }
    }
}
